package com.cqq.common.core.base;

/**
 * <h3>异常基类</h3>
 *
 * <p>
 * 所有异常类的基类，增加了异常代码和对应异常消息的定义。
 * </p>
 * 
 * @author xijq
 * @version 1.0.0
 * 
 */
public abstract class BaseException extends Exception {

	private static final long serialVersionUID = 2281173614433470457L;

	/**
	 * 异常代码
	 */
	protected String errorCode;

	/**
	 * 异常信息
	 */
	protected String errorMsg;

	/**
	 * 相关异常类
	 */
	protected Throwable caused;
	
	public BaseException(String errorCode) {
		this.errorCode = errorCode;
	}
	
	public BaseException(String errorCode, String errorMsg) {
		super(errorMsg);
		this.errorCode = errorCode;
		this.errorMsg = errorMsg;
	}

	public BaseException(String errorCode, Throwable caused) {
		super(caused);
		this.errorCode = errorCode;
		this.caused = caused;
	}

	public BaseException(String errorCode, String errorMsg, Throwable caused) {
		super(errorMsg, caused);
		this.errorCode = errorCode;
		this.errorMsg = errorMsg;
		this.caused = caused;
	}

	public String getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}

	public String getErrorMsg() {
		return errorMsg;
	}

	public void setErrorMsg(String errorMsg) {
		this.errorMsg = errorMsg;
	}

	public Throwable getCaused() {
		return caused;
	}

	public void setCaused(Throwable caused) {
		this.caused = caused;
	}
	
}
